package common.dao;

import common.DataExchange;
import common.domain.Student;

import java.io.IOException;
import java.util.HashMap;

/**
 * @author LinLe
 * @create 2020-12-27 12:21
 */
//服务器对于学员对自己信息的操作
public class StuUserOperator {
    private HashMap<String, Student> stuMap;
    
    public StuUserOperator() {
    }
    
    public StuUserOperator(HashMap<String, Student> stuMap) {
        this.stuMap = stuMap;
    }
    
    public void changePassword(DataExchange de) throws IOException, ClassNotFoundException {
        String name = de.receiveString();
        de.sendString(stuMap.get(name).getPassword());
        String password = de.receiveString();
        stuMap.put(name,new Student(name,password));
        de.sendString("修改密码成功");
    }
    
}
